/*
 * Copyright (C) Michael Opitz
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
 * USA
 */
#ifndef TITLE_ADAPTER_H
#define TITLE_ADAPTER_H

#include "../model/title.h"

#include <boost/shared_ptr.hpp>

/** 
 * \brief This namespace includes all music-related stuff.
 * \author Michael Opitz
 */
namespace music {
	/** 
	 * \brief This class is an adapter for the model::title class to work
	 * with the apriori-algorithm.
	 */
	class title_adapter {
	public:
		title_adapter(boost::shared_ptr<model::title> t):_title(t) {}
		~title_adapter() {}

		/** 
		 * \brief == compares two titles with the title-name
		 */
		bool operator == (const title_adapter &t) const 
		{
			return _title->get_title() == 
				t._title->get_title();
		}
		/** 
		 * \brief != compares two titles with the title-name
		 */
		bool operator != (const title_adapter &t) const
		{
			return !((*this) == t);
		}
		/** 
		 * \brief get returns the internal model::title-object
		 */
		boost::shared_ptr<model::title> get() { return _title; }

		/** 
		 * \brief print prints the title; for debug purposes only
		 */
		void print() const { _title->print(); }
	private:
		boost::shared_ptr<model::title> _title;
	};
}

ostream& operator << (ostream &rhs, music::title_adapter &set);

#endif
